function WebSocketTest(name,msgLisenter) {
    if ("WebSocket" in window) {
        var ws = new WebSocket(wsUrl+name);
        ws.onopen = function () {
        };
        ws.onmessage = function (event) {
            var msg = JSON.parse(event.data);
            var messageType = msg.type;
            if (messageType == 'ALARM') {
                msgLisenter(JSON.parse(msg.content));
            }
        };

        ws.onclose = function () {
            console.log("连接已关闭...");
        };
    } else {
        console.log("您的浏览器不支持 WebSocket!");
    }
}


var name = common.dateFormatter_inverse(new Date(new Date(new Date().toLocaleDateString()).getTime()));
WebSocketTest(name,function (msg) {
    $("#tip").show();
    $("#tipContent").html(msg.description);
});
